package com.oceansoft.mobile.econsole.mybaties.mapper;

import org.springframework.util.Assert;

import java.io.Serializable;

/**
 * <strong>DalUtils</strong><br>
 * <br>
 * <strong>Create on : 2011-12-14<br></strong>
 * <p/>
 * <strong>Copyright (C) Ecointel Software Co.,Ltd.<br></strong>
 * <p/>
 *
 * @author peng.shi peng.shi@ecointel.com.cn<br>
 * @version <strong>Ecointel v1.0.0</strong><br>
 */
public class DalUtils {

    /**
     * 判断是否DO对象是否存在
     *
     * @param mapper 公共mapper
     * @param key    序列
     * @return boolean
     */
    @SuppressWarnings({"rawtypes", "unchecked"})
    public static boolean isExist(BaseMapper mapper, Serializable key) {
        Assert.notNull(mapper);
        Assert.notNull(key);
        Object o = mapper.load(key);
        return o != null;
    }
}
